class DataSentence:
    def __init__(self, tablename, keywords=None):
        self.tablename = tablename
        self.keywords = keywords

    def select(self):
        if self.keywords:
            keys = ','.join(self.keywords)
            result = f"SELECT {keys} FROM {self.tablename}"
        else:
            result = f"SELECT * FROM {self.tablename}"
        return result

    def count(self):
        result = f"SELECT COUNT(*) FROM {self.tablename}"
        return result


    def insert(self):
        key = [f'`{key}`' for key in self.keywords]
        value = [f"'{value}'" for value in self.keywords.items()]
        keys, values = ",".join(key), ",".join(value)
        result = f"INSERT ignore INTO `{self.table}`({keys}) VALUES({values})"
        return result


def delete(self):
    return f"delete from {self.table} where id = '{self.keywords.get('id')}'"


def update(self):
    data = [f"`{key}`='{value}'" for key, value in self.keywords.items() if key != 'id']
    update_list = ','.join(data)
    return f"UPDATE {self.table} SET {update_list} WHERE `id`='{self.keywords.get('id')}'"
